package ups.Common;

import java.util.Date;
import ups.MapParse.Point;

public class Ship {
	
	private String name;
	private Point location;
	private int heading;
	private boolean isMoving;
	private Date date;
	
	public Ship(String name, Point location, boolean isMoving, int heading) {
		super();
		this.name = name;
		this.location = location;
		this.heading = heading;
		this.isMoving = isMoving;
	}
	
	public int getHeading() {
		return heading;
	}
	public void setHeading(int heading) {
		this.heading = heading;
	}
	
	public void setDate( Date date ) {
		this.date = date;
	}
	
	public Date getDate() {
		return this.date;
	}
	
	public boolean isMoving() {
		return isMoving;
	}
	public void setMoving(boolean isMoving) {
		this.isMoving = isMoving;
	}
	public Point getLocation() {
		return location;
	}
	public void setLocation(Point location) {
		this.location = location;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	public String toString() {
		if( date == null ) {
			return this.getName() + " " + this.getLocation().toString() + " " + this.isMoving() + " " + this.getHeading();
		}
		else {
			return this.getName() + " " + this.getLocation().toString() + " " + this.isMoving() + " " + this.getHeading() + " " + this.getDate().toString();
		}
	}
}
